<?php defined('SYSPATH') or die('No direct script access.');
require ('application/classes/dao/base.php');

class Controller_labelm extends Controller {


    public function action_index(){
        $result = rpcCall("label.labellist",null);
        echo View::factory('manager/label')->bind("label",$result);
    }

    public function action_add(){
        $parm = post($this->request);
        $result = rpcCall("label.add",$parm);
        echo "<script>window.location.href='".Url::base()."index.php/labelm/index'</script>";
    }

    public function action_detail(){
        $parm = get($this->request);
        $result = rpcCall("label.detail",$parm);
        echo View::factory('manager/updatelabel')->bind("label",$result);
    }

    public function action_updateData(){
        $parm = post($this->request);
        $result = rpcCall("label.update",$parm);
        echo "<script>window.location.href='".Url::base()."index.php/labelm/index'</script>";
    }
    //根据model获取标签数据
    public function action_getlist(){

        $parm = get($this->request);
        if(!isset($parm['model']) ||($parm['model'])==""){
            echo "model不能为空";
            exit;
        }
        $result = rpcCall("label.getLabelByModel",$parm);
        echo json_encode($result);

    }
}